package com.cskaoyan.service.impl;

import com.cskaoyan.bean.CskaoyanmallRole;
import com.cskaoyan.mapper.CskaoyanmallRoleMapper;
import com.cskaoyan.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.HashSet;
import java.util.Set;

/**
 * @author Fantasylkh
 */
@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    CskaoyanmallRoleMapper roleMapper;

    @Override
    public Set<String> selectRolesByRoleIds(Integer[] roleIds) {
        Set<String> roleSet = new HashSet<>();
        if (!ObjectUtils.isEmpty(roleIds)) {
            for (Integer roleId : roleIds) {
                CskaoyanmallRole role = roleMapper.selectByPrimaryKey(roleId);
                roleSet.add(role.getName());
            }
        }
        return roleSet;
    }
}
